function formatNumber(n) {
  n = n.toString()
  return n[1] ? n : '0' + n
}

// 仅处理 <= 99
function number2Chinese(num){
	if(num > 99){
		return '';
	}

	var arr = '一二三四五六七八九十'.split('');
	arr.unshift('');

	if(num <= 10){
		return arr[num];
	}else if(num < 20){
		return '十' + arr[num % 10];
	}else{
		return arr[parseInt(num / 10)] + '十' + arr[num % 10];
	}

}

function selectOne(index, arr){
	arr.forEach(function(entry, i){
		if(i == index){
			entry.selected = true;
		}else{
			entry.selected = false;
		}
	});
}

function setNavigationBarTitle(title){
	wx.setNavigationBarTitle({
		title: title,
		success: function(res) {
			// success
		}
	});
}

module.exports = {
  number2Chinese: number2Chinese,
	selectOne: selectOne,
	setNavigationBarTitle: setNavigationBarTitle
}
